package exc;

import org.junit.Test;

public class ExchangeAWithB {
	@Test
	public void exchangeTest(){
		int a = 10;
		int b = 22;
		a += b;
		b = a - b;
		a = a - b;
		System.out.println("现在我是A： " + a);
		System.out.println("现在我是B： " + b);
		printStar1();
		printStar2();
		printStar1();
		printStar2();
		printStar1();
		printStar2();
		printStar3();
		printStar4();
		printStar3();
		printStar4();
		printStar3();
		printStar4();
		printStar3();
		printStar4();
	}
	private void printStar1(){
		for(int i=1; i<=10; i++){
			for(int j=0; j<=i; j++){
				System.out.print("*");
			}
			System.out.println();
		}
	}
	private void printStar2(){
		for(int i=1; i<=10; i++){
			for(int j=i; j<=10; j++){
				System.out.print("*");
			}
			System.out.println();
		}
	}
	private void printStar3(){
		for(int i=1; i<=10; i++){
			for(int j=1; j<=10; j++){
				if((j+i)>=11 && (j+i)<=(i+10)){
					System.out.print("*");
				}else{
					System.out.print(" ");
				}
			}
			System.out.println();
		}
	}
	private void printStar4(){
		for(int i=1; i<=10; i++){
			for(int j=1; j<=10; j++){
				if((j+i)<=11){
					System.out.print("*");
				}else{
					System.out.print(" ");
				}
			}
			System.out.println();
		}
	}
}
